from rest_framework.viewsets import ModelViewSet
from meiduo_mall_admin.my_paginate import MyPageNumberPagination
from users.models import User
from . import permission_admin_serializer
from rest_framework.generics import ListAPIView
from django.contrib.auth.models import Group


class PermissionAdminViews(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = permission_admin_serializer.PermissionAdminSerializer
    queryset = User.objects.filter(is_superuser=True, is_staff=True).all()


class PermissionGroupAdminViews(ListAPIView):
    serializer_class = permission_admin_serializer.PermissionGroupAdminSerializer
    queryset = Group.objects.all()
